public class prime_number {
    public static void main(String[] args) {
                int n = 100;
                System.out.println("100以内的素数有：");
                for (int i = 2; i <= n; i++) {
                    if (isPrime(i)) {
                        System.out.print(i + " ");
                    }
                }
            }

            public static boolean isPrime(int num) {
                if (num <= 1) {
                    return false;
                }

                for (int i = 2; i <= Math.sqrt(num); i++) {
                    if (num % i == 0) {
                        return false;
                    }
                }

                return true;
            }
        }